/*
 * Point2.h
 *
 *  Created on: 2012/07/04
 *      Author: weihe
 */

#ifndef POINT2_H_
#define POINT2_H_

#include <cmath>

namespace geom {

class Point2f {
public:
	float x, y;
	Point2f(float x = 0, float y = 0) :
			x(x), y(y) {
	}

	static float distance(Point2f a, Point2f b) {
		float dx = a.x - b.x;
		float dy = a.y - b.y;
		return sqrt(dx * dx + dy * dy);
	}

	Point2f operator-(Point2f p) {
		return Point2f(x - p.x, y - p.y);
	}
};

} /* namespace geom */
#endif /* POINT2_H_ */
